/**
 * 公告详情 - 编辑页面
 * @author shixc
 * @date 2018/02/27
 */
define(function () {

    var self,
        app = win.app,
        doc = document,
        fileList = [],
        callObj
    ;

    var Notice_detail = app.Module.extend({
        init: function () {
            self = this;
            self._super({
                _tag: 'notice_detail'
            }, win);
            layui.use('form', function () {
                var form = layui.form;
            });
        },

        _call: function (obj) {
            $("#GWDH001").html('');
            $("#GWDH005").html('');
            $("#GWDH006").html('');
            $("#GWDH007").html('');
            $("#GWDH008").html('');
            app.ajax({
                xurl: 'sys/notice/getDetailData',
                xdata: {GWDHDOCNO: obj},
                cb: function (result) {
                    if (result.ok) {
                        var a = '';
                        $("#file").html('');
                        if(result.data.data.file) {
                            for (var i = 0; i < result.data.data.file.length; i++) {
                                a = a + '<a href="/wissun-smfile/' + result.data.data.GWDH008 + '">' + result.data.data.file[i].GWDHE002 + '</a>' + '<br> ';
                            }
                            $("#file").html('<p>附件</p><div>' + a + '</div>');
                        }
                        $("#GWDH001").html(result.data.data.GWDH001);
                        $("#GWDH005").html(result.data.data.GWDH005);
                        $("#GWDH006").html(result.data.data.GWDH006);
                        $("#GWDH007").html(result.data.data.GWDH007);
                        $("#GWDH008").html('');
                        if(result.data.data.GWDH008 != undefined && result.data.data.GWDH008 != "") {
                            $("#GWDH008").html('<p>图片:<span><img src="/wissun-smfile/' + result.data.data.GWDH008 + '"></span></p>');
                        }
                    }
                }
            });
        },
        _ready: function () {
            var vue = new Vue({
                el: '#notice_detail',
                data: {
                    filelist: fileList
                },
                methods: {
                    cancel: function () {
                        fileList = [];
                        layer.close(layer.index);
                    }
                },
                watch: {},
                created: function () {
                    self._setEleIsReady('notice_detail');
                }
            });
        },
        _lazy: function () {
            this._super();
        }
    });

    return new Notice_detail();

});